package com.opener.web.acl.model;

import com.opener.common.model.Model;

import java.util.Date;
import java.util.List;

/**
 *
 * @author baboy
 * @date 01/12/2016
 */
public class UserRole extends Model {
    private static final long serialVersionUID = -2304780547806316040L;
    public static final String STATUS_ACTIVE = "active";
    public static final String STATUS_INVALID = "invalid";
    private Integer id;
    private String key;
    private String status;
    private String name;
    private String description;
    private Integer createUid;
    private Date createTime;
    private Integer updateUid;
    private Date updateTime;
    private List<Integer> requestScope;
    private List<Integer> userRequestScope;
    private List<SysFunction> functions;
    private List<Integer> functionIds;
    private boolean isAdmin;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getCreateUid() {
        return createUid;
    }

    public void setCreateUid(Integer createUid) {
        this.createUid = createUid;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getUpdateUid() {
        return updateUid;
    }

    public void setUpdateUid(Integer updateUid) {
        this.updateUid = updateUid;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public List<Integer> getRequestScope() {
        return requestScope;
    }

    public void setRequestScope(List<Integer> requestScope) {
        this.requestScope = requestScope;
    }

    public List<Integer> getUserRequestScope() {
        return userRequestScope;
    }

    public void setUserRequestScope(List<Integer> userRequestScope) {
        this.userRequestScope = userRequestScope;
    }

    public List<SysFunction> getFunctions() {
        return functions;
    }

    public void setFunctions(List<SysFunction> functions) {
        this.functions = functions;
    }

    public boolean isAdministrator(){
        return key != null && "admin".equalsIgnoreCase(key);
    }

    public List<Integer> getFunctionIds() {
        return functionIds;
    }

    public void setFunctionIds(List<Integer> functionIds) {
        this.functionIds = functionIds;
    }

    public boolean isAdmin() {
        return isAdmin;
    }

    public void setAdmin(boolean admin) {
        isAdmin = admin;
    }
}
